import { handleActions } from 'redux-actions';

import { save, clear } from '../actions/CalcRiskAction';

const initialState = {
  isInputCompleted: false,
  inputData: {},
  pageIndex: 0,
}

const bodyData = handleActions({
  [save]: (state, action) => {
    return Object.assign({}, state, {
      inputData: action.payload.inputData,
      pageIndex: action.payload.pageIndex,
      isInputCompleted: true,
    });
  },
  [clear]: () => {
    return Object.assign({}, initialState);
  },
}, initialState);

export default bodyData
